package com.soup.lab.third.token;

public class TokenPack {
    private final Token token;
    private final TokenConfig tokenConfig;

    public TokenPack(Token token, TokenConfig tokenConfig) {
        this.token = token;
        this.tokenConfig = tokenConfig;
    }

    public Token getToken() {
        return token;
    }

    public TokenConfig getTokenConfig() {
        return tokenConfig;
    }

    public boolean isTokenValid() {
        return token != null && token.isValid();
    }

    public String getTokenContent() {
        return token == null ? null : token.getContent();
    }

    public static TokenPack empty(TokenConfig config) {
        return new TokenPack(null, config);
    }

    @Override
    public String toString() {
        return "TokenPack{" +
                "token=" + token +
                ", tokenConfig=" + tokenConfig +
                '}';
    }
}
